package coasttocoast.game.units;

import coasttocoast.game.SeaUnit;
import coasttocoast.game.Transporter;
import coasttocoast.game.Unit;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @author gsh
 */
public class Transport extends SeaUnit implements Transporter {
  public static final int MAX_HEALTH = 3;
  public static final int MOVEMENT = 2;
  public static final int ATTACK = 1;
  public static final int MAX_CARGO = 2;

  private List<Unit> containedUnits = new ArrayList<Unit>();

  public Transport(int id) {
    super(id);
  }

  public int getMovement() {
    return MOVEMENT;
  }

  public int getAttack() {
    return ATTACK;
  }

  public int getMaxHealth() {
    return MAX_HEALTH;
  }

  public Collection<Unit> getContainedUnits() {
    return Collections.unmodifiableCollection(containedUnits);
  }

  public void addUnit(Unit unit) {
    if (containedUnits.size() < MAX_CARGO) {
      containedUnits.add(unit);
    }
  }

  public void removeUnit(Unit unit) {
    containedUnits.remove(unit);
  }

  public int getMaxCargoSpace() {
    return MAX_CARGO;
  }
}
